﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Templete.master" AutoEventWireup="true"
    CodeFile="MobileList.aspx.cs" Inherits="Mobile_MobileList" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" runat="Server">
    <script type="text/javascript">
          $(document).ready(function () {

              /* setup navigation, content boxes, etc... */
              Administry.setup();
             
              /* progress bar animations - setting initial values */
	          Administry.progress("#progress1", 1, 6); 
              // validate form on keyup and submit
              var validator = $("#aspnetForm").validate({
                
                  rules: {
                                  
                      <%# txtIMEI.UniqueID %>: "required"
                  },
                  messages: {
                       <%# txtIMEI.UniqueID %>: "设备编号不能为空"
                  },
                  // the errorPlacement has to take the layout into account
                  errorPlacement: function (error, element) {
                      error.insertAfter(element.parent().find('label:first'));
                  },
                  //specifying a submitHandler prevents the default submit, good for the demo
		        submitHandler: function(id) {
                var data = { 
                    id: id,
                    imei: $('#<%# txtIMEI.ClientID %>').val(),
                    brand: $('#<%# txtBrand.ClientID %>').val(),
                    model: $('#<%# txtModel.ClientID %>').val(),
                    chkValid: $('#<%# chkValid.ClientID %>').val()
                    };

                 $.post("MobileList.aspx",data,function(data){

                  if(data.result=="success"){
                    alert('修改成功');
                  }
                },"json"
                );
               
		    },

                
                  // set new class to error-labels to indicate valid fields
                  success: function (label) {
                      // set &nbsp; as text for IE
                      label.html("&nbsp;").addClass("ok");
                  }
              });

             

          });

          function Commit(id)
          {
                
          }
    </script>
    <fieldset>
        <legend>移动设备资料管理</legend>
        <p class="box">
            <asp:Literal ID="Literal8" runat="server" meta:resourcekey="Quick"></asp:Literal>
            <input id="txtSearch" type="text" runat="server" maxlength="32" />
            <asp:Button ID="btnSearch" runat="server" class="btn btn-green" Text="查  询" OnClick="btnSearch_Click" />
        </p>
        <asp:GridView Width="100%" ID="GridView1" runat="server" AutoGenerateColumns="False"
            CssClass="display stylized" EmptyDataText="没有可显示的数据." EmptyDataRowStyle-Font-Bold="true"
            EmptyDataRowStyle-HorizontalAlign="Center" BorderWidth="0" AllowPaging="false"
            PageSize="8">
            <EmptyDataRowStyle HorizontalAlign="Center" Font-Bold="True"></EmptyDataRowStyle>
            <Columns>
                <asp:BoundField DataField="IMEICode" HeaderText="设备编号" />
                <asp:BoundField DataField="BrandName" meta:resourcekey="HeaderBrand" />
                <asp:BoundField DataField="Model" meta:resourcekey="HeaderModel" />
                <asp:TemplateField meta:resourcekey="HeaderIsActive">
                    <ItemTemplate>
                        <font size='3' color='green' style="font-weight: bold">
                            <%# Convert.ToBoolean(Eval("Active")) ? "√" : "×"%>
                        </font>
                    </ItemTemplate>
                </asp:TemplateField>
                <asp:TemplateField meta:resourcekey="HeaderControl">
                    <ItemTemplate>
                        <input type="button" class="btn" value="修改" onclick='Commit(<%# Eval("ID") %>)' />
                        <%--<asp:Button ID="btnModify" CommandName="Select" class="btn" Text="修改" runat="server" />--%>
                    </ItemTemplate>
                </asp:TemplateField>
            </Columns>
            <RowStyle CssClass="gradeA" />
            <AlternatingRowStyle CssClass="gradeC" />
        </asp:GridView>
    </fieldset>

    <fieldset>
        <legend>设备信息维护</legend>
        <p>
            <asp:Literal ID="Literal2" runat="server" meta:resourcekey="DeviceInfo" />
            <asp:Literal ID="litInfo" runat="server"></asp:Literal>
        </p>
        <p>
            设备编号<label class="required" for=" <%# txtIMEI.UniqueID %>">:</label><br />
            <input type="text" runat="server" id="txtIMEI" class="half" value="" maxlength="20" />
        </p>
        <p>
            品牌<br />
            <input type="text" runat="server" id="txtBrand" class="half" value="" />
        </p>
        <p>
            <label>
                型号:</label><br />
            <asp:TextBox ID="txtModel" class="half" runat="server" MaxLength="18"></asp:TextBox>
        </p>
        <p>
            <input type="checkbox" id="chkValid" runat="server" checked />
            <label class="choice" for="chkValid">
                有效</label>
        </p>
    </fieldset>
    <p class="box">
        <asp:Button ID="btnSave" runat="server" class="btn btn-green" Text="提  交" OnClick="btnSave_Click" />
        <a runat="server" id="btnCancel" class="btn"><span class="icon icon-cancel">&nbsp;</span>清空</a>
    </p>
    <script type="text/javascript">
        $(document).ready(function () {
            Administry.setup();
            $('#<%# GridView1.ClientID %>').dataTable();
            Administry.expandableRows();
        });
    </script>
</asp:Content>
